package net.huashitong.interview.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.interview.dao.SummaryDao;
import net.huashitong.interview.databean.BusinessSummary;
import net.huashitong.interview.databean.CommerceSummary;
import net.huashitong.interview.databean.IndustrySummary;
import net.huashitong.interview.databean.ServeSummary;
import net.huashitong.interview.entity.ProblemSummary;
import net.huashitong.interview.filter.SummaryRequestModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SummaryService extends StringPKService<ProblemSummary> {

    @Autowired
    private SummaryDao dao;

    @Autowired
    private SysTableService tableService;

    @Override
    protected BaseDao<ProblemSummary, String> getDao() {
        return dao;
    }
    @Override
    protected void beforeSave(ProblemSummary obj) {
        obj.setSysId(tableService.updateMaxSysId("t_gis_interviewProblemSummary", null));
    }

    public Object querySummary(SummaryRequestModel model){
        List<BusinessSummary> list = dao.queryBusinessSummary(model);
        if(list.size()>0&&list!=null){
            return list;
        }else{
            return null;
        }
    }
    public String getNewFillDate(){
        return dao.getNewFillDate();
    }
}
